﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Business.Classes;
using DAL;
using System.Collections.Generic;

namespace UI
{
    public partial class ConsultarSeguidores : System.Web.UI.Page
    {
        UsuarioBusiness usuarioBusiness = new UsuarioBusiness();
        Usuario user = null;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //Pegar o usuario logado depois.
                user = (Usuario)Session["user"];
                if (user == null)
                {
                    Response.Redirect(new Controlador.Controladora().GetHomePage());
                }

                
                List<Usuario> userSeguidores = usuarioBusiness.GetSeguidoresByUsuario(user);

                GdSeguidores.DataSource = (from u in userSeguidores select new {u.nome, u.pontos, dataNascimento = u.dataNascimento.ToString("dd/MM/yyyy")});
                GdSeguidores.DataBind();

            }
        }
    }
}
